<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateQhQuestionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('qh_questions', function (Blueprint $table) {
            $table->id();
            $table->integer('qlId', false, true)->comment('题库ID');
            $table->integer('courseId', false, true)->comment('学科ID');
            $table->integer('knowledgeId', false, true)->comment('知识点ID');
            $table->integer('questionTypeId', false, true)->comment('题型ID');
            $table->text('title')->nullable()->comment('题干');
            $table->text('options')->nullable()->comment('选项，用|NTK|分割');
            $table->tinyInteger('optionCount')->nullable()->default(0)->comment('选项数量');
            $table->text('answer')->nullable()->comment('答案');
            $table->text('analysis')->nullable()->comment('解析');
            $table->string('area')->nullable()->comment('地区');
            $table->string('questionFrom')->nullable()->comment('试题来源');
            $table->tinyInteger('difficulty')->nullable()->default(0)->comment('难度，012易中难');
            $table->float('difficultyValue')->nullable()->default(0)->comment('难度值0-1');
            $table->integer('rightCount')->nullable()->default(0)->comment('答对次数');
            $table->integer('wrongCount')->nullable()->default(0)->comment('答错次数');
            $table->integer('sort')->nullable()->default(0)->comment('排序');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('qh_questions');
    }
}
